from test_tools.script.path_tool import *
from test_tools.view.excel_tools_view import ExcelToolsView


def print_path():
    """输出脚本和程序工作目录"""
    log("==========输出脚本和程序工作目录==========")
    current_dir = os.path.dirname(os.path.abspath(__file__))
    working_dir = os.getcwd()
    log(f"当前脚本 {os.path.basename(__file__)} 运行目录： {current_dir}")
    log(f"当前程序工作目录：{working_dir}")
    log("======================================")


if __name__ == '__main__':
    try:
        print_path()
        app = QApplication(sys.argv)
        excel_tools_view = ExcelToolsView(app)
        excel_tools_view.show()
        sys.exit(app.exec())
    except Exception as e:
        log(e)
        error_details = traceback.format_exc()
        message = ExcelToolsMessageView()  # 信息弹窗控件
        message.show_message(f"{os.path.basename(__file__)} >>> 初始化主窗口 异常：{error_details}")
